package com.gitee.wsl.collections.map.bidimap

import com.gitee.wsl.collections.map.api.BidiMap


/**
 * Implements [BidiMap] with two [LinkedHashMap] instances.
 *
 *
 * Two [LinkedHashMap] instances are used in this class.
 * This provides fast lookups at the expense of storing two sets of map entries and two linked lists.
 *
 *
 * @param <K> the type of the keys in the map
 * @param <V> the type of the values in the map
 * @since 4.0
</V></K> */
//class DualLinkedHashBidiMap<K, V> : AbstractDualBidiMap<K, V>{
//    /**
//     * Creates an empty `HashBidiMap`.
//     */
//    constructor() : super(LinkedHashMap(), LinkedHashMap())
//
//    /**
//     * Constructs a `LinkedHashBidiMap` and copies the mappings from
//     * specified [Map].
//     *
//     * @param map the map whose mappings are to be placed in this map
//     */
//    constructor(map: Map< K,V>) : super(LinkedHashMap(), LinkedHashMap()) {
//        putAll(map)
//    }
//
//    /**
//     * Constructs a `LinkedHashBidiMap` that decorates the specified maps.
//     *
//     * @param normalMap      the normal direction map
//     * @param reverseMap     the reverse direction map
//     * @param inverseBidiMap the inverse BidiMap
//     */
//    protected constructor(
//        normalMap: Map<K?, V?>?, reverseMap: Map<V?, K?>?,
//        inverseBidiMap: BidiMap<V?, K?>?,
//    ) : super(normalMap, reverseMap, inverseBidiMap)
//
//    /**
//     * Creates a new instance of this object.
//     *
//     * @param normalMap      the normal direction map
//     * @param reverseMap     the reverse direction map
//     * @param inverseBidiMap the inverse BidiMap
//     * @return new bidi map
//     */
//    protected override fun createBidiMap(
//        normalMap: Map<V, K>, reverseMap: Map<K?, V?>?,
//        inverseBidiMap: BidiMap<K?, V?>?,
//    ): BidiMap<V?, K?> {
//        return DualLinkedHashBidiMap<V?, K?>(normalMap, reverseMap, inverseBidiMap)
//    }
//
//    /**
//     * Deserializes an instance from an ObjectInputStream.
//     *
//     * @param in The source ObjectInputStream.
//     * @throws IOException            Any of the usual Input/Output related exceptions.
//     * @throws ClassNotFoundException A class of a serialized object cannot be found.
//     */
//    @Throws(IOException::class, java.lang.ClassNotFoundException::class)
//    private fun readObject(`in`: ObjectInputStream) {
//        `in`.defaultReadObject()
//        normalMap = LinkedHashMap()
//        reverseMap = LinkedHashMap()
//        val map = `in`.readObject() as Map<K?, V?>?
//        putAll(map)
//    }
//
//    /**
//     * Serializes this object to an ObjectOutputStream.
//     *
//     * @param out the target ObjectOutputStream.
//     * @throws IOException thrown when an I/O errors occur writing to the target stream.
//     */
//    @Throws(IOException::class)
//    private fun writeObject(out: ObjectOutputStream) {
//        out.defaultWriteObject()
//        out.writeObject(normalMap)
//    }
//
//    companion object {
//        /** Ensure serialization compatibility  */
//        private const val serialVersionUID = 721969328361810L
//    }
//}
